﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DAL.MySQL;
using Models;
using PetaPoco;

namespace Core
{
    public class adclassCore
    {
        private readonly adclassDAL dal = new adclassDAL();

        public adclassEntity GetOne(int id)
        {
            return dal.GetOne(id) == null ? new adclassEntity() : dal.GetOne(id);
        }
        public adclassEntity Save(adclassEntity model)
        {
            return dal.Save(model);
        }

        public int Update(object obj,int ID)
        {
            return dal.Update(obj, ID);
        }

        public bool Del(int id)
        {
            return dal.Del(id);
        }
        public bool Del(adclassEntity model)
        {
            return dal.Del(model);
        }

        public List<adclassEntity> GetList(int top, string where, string order, params object[] args)
        {
            if (top<= 0)
                return dal.GetList(where, order, args);
            return dal.GetPageList(1, top, where, order, args).Items;
        }
        public Page<adclassEntity> GetPageList(int page,int pagesize, string where, string order, params object[] args)
        {
            return dal.GetPageList(page, pagesize, where, order, args);
        }
    }
}
